//
//  SubmitGoodsCell.m
//  体育商城
//
//  Created by  on 2022/9/24.
//

#import "SubmitGoodsCell.h"
@interface SubmitGoodsCell()
@property (strong, nonatomic) IBOutlet UIButton *store;
@property (strong, nonatomic) IBOutlet UIImageView *img;
@property (strong, nonatomic) IBOutlet UILabel *title;
@property (strong, nonatomic) IBOutlet UILabel *detail;
@property (strong, nonatomic) IBOutlet UILabel *money;
@property (strong, nonatomic) IBOutlet UILabel *finalMoney;
@end
@implementation SubmitGoodsCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (void)setModel:(Goods *)model{
    if (_model != model) {
        if (self.task) {
            [self.task cancel];
        }
        self.img.image = nil;
        self.title.text = [NSString stringWithFormat:@"%@ %@",model.brandName,model.shortDescription];
        self.money.text = [NSString stringWithFormat:LS(@"¥:%@"),model.price];
        self.finalMoney.text = [NSString stringWithFormat:LS(@"¥:%@"),model.price];
        self.detail.text = [NSString stringWithFormat:LS(@"月销量%d万+"),[model.productReference intValue] / 10000];
        [self.store setTitle:model.name forState:UIControlStateNormal];
        self.task = [UIImage imageWithURL:model.mainImage block:^(UIImage * _Nonnull image) {
            self.img.image = image;
        }];
    }
}
@end
